using System;
using System.Collections;
using System.Collections.Generic;

namespace HelloWorld.Learn
{
    public class EnumerableDemo
    {
        public static IEnumerable<double> Power(int number, int exponent)
        {
            for (int i = 0; i <= exponent; i++)
            {
                yield return Math.Pow(number, i);
            }
        }

        public static void Demo()
        {
            foreach (int i in Power(2, 8))
            {
                Console.Write("{0} ", i);
            }
            Console.WriteLine();
        }
    }
}